prefer-remote-fetch: fix fetchurl eval#457086
Conversation
3ffa1e0 to
e6dc008
Compare
| fetchurl = args: super.fetchurl (super.lib.extends | ||
| (super.lib.toExtension { preferLocalBuild = args.preferLocalBuild or false; }) | ||
| (super.lib.toFunction args)); |
There was a problem hiding this comment.
Sorry, I forgot to consider that args might be a function when writing args.prefenLocalBuild or false.
It should be
| fetchurl = args: super.fetchurl (super.lib.extends | |
| (super.lib.toExtension { preferLocalBuild = args.preferLocalBuild or false; }) | |
| (super.lib.toFunction args)); | |
| fetchurl = fpArgs: super.fetchurl (super.lib.extends | |
| (finalAttrs: args: { preferLocalBuild = args.preferLocalBuild or false; }) | |
| (super.lib.toFunction fpArgs)); |
Or,
| fetchurl = args: super.fetchurl (super.lib.extends | |
| (super.lib.toExtension { preferLocalBuild = args.preferLocalBuild or false; }) | |
| (super.lib.toFunction args)); | |
| fetchurl = lib.extendMkDerivation { | |
| constructDrv = previous.fetchurl; | |
| extendDrvArgs = finalAttrs: args: { preferLocalBuild = args.preferLocalBuild or false; }; | |
| } |
The latter handles the __functionArgs automatically.
There was a problem hiding this comment.
The 2nd failed with:
error:
… while calling the 'head' builtin
at /home/sandro/src/nixpkgs/lib/attrsets.nix:1696:13:
1695| if length values == 1 || pred here (elemAt values 1) (head values) then
1696| head values
| ^
1697| else
… while evaluating the attribute 'value'
at /home/sandro/src/nixpkgs/lib/modules.nix:1118:7:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/store/p5jrkni7q6pa7ckfyqrrjysqh8i5nmdf-source/nixos/modules/system/activation/top-level.nix':
… while evaluating the option `system.activationScripts':
… while evaluating definitions from `/nix/store/6mis9m031ia3c7fmxh3gqrq4782dmppn-source/modules/ssh.nix':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: function 'extendDrvArgs' called with unexpected argument 'prefetchLocalBuild'
at /home/sandro/src/nixpkgs/pkgs/build-support/fetchurl/default.nix:72:5:
71| finalAttrs:
72| {
| ^
73| # URL to fetch.
There was a problem hiding this comment.
The 2nd failed with:
That's due to a typo. It should be preferLocalBuild instead of prefetchLocalBuild.
There was a problem hiding this comment.
Updated. Sorry for the trouble.
555d2bf to
dc24b58
Compare
dc24b58 to
bd107d4
Compare
philiptaron
left a comment
There was a problem hiding this comment.
Wow, this is convoluted.
Is there a test for these derivation mutators (a phrase I just made up) @SuperSandro2000 that I should run to make sure it's not broken?
|
Probably not but it would probably be as easy as just evalling pkgs with it as an overlay |
|
Maybe it can be added to lib-tests? |
…r internals Replaces NixOS#457086
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
…r internals Replaces NixOS#457086 (cherry picked from commit 8d2dad0)
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.